    <script type="text/javascript">
    var tt = 0;
    $(function(){
    	sy.ns('sy.admin.menu${(OP.TMenu.id)!}');
    	 $('#admin_menu${(OP.TMenu.id)!}_datagrid').bootstrapTable({ 
             url:'${(OP.TMenu.channel)!}/list.${(cfg.suffix)!'action'}',
             height: '100%',
             sortName: 'optime',
             sortOrder: 'desc',
             striped: true,
             pagination: true,
             pageSize: 10,
             pageList: [10, 25, 50, 100, 200],
             search: false,
             sidePagination:'server',
             idField: 'id',
             uniqueId: 'id',
            responseHandler: responseHandler,
            queryParams: queryParams,
             minimumCountColumns: 2,
             clickToSelect: true,
             columns: [
                       {
                // field: 'id',
                 checkbox: true
             }, {
                 field: 'title',
                 title: '标题',
                 align: 'center',
                 valign: 'middle',
                 sortable: true
               //  formatter: nameFormatter
             },{
            	 title : '地址',
 				field : 'url',
                 align: 'center',
                 valign: 'middle',
                 sortable: true
               //  formatter: nameFormatter
             },
             {
                 field: 'account',
                 title: '帐号',
                 align: 'center',
                 valign: 'middle',
                 sortable: true
               //  formatter: nameFormatter
             },{
            	 title : 'IP',
 				field : 'ip',
                 align: 'left',
                 valign: 'top',
                 sortable: true
                // formatter: priceFormatter,
               //  sorter: priceSorter
             }, {
            		title : '消息',
    				field : 'message',
                 align: 'center',
                 valign: 'middle'
                // clickToSelect: false,
                // formatter: operateFormatter,
                // events: operateEvents
             } , {
            		title : '操作时间',
    				field : 'optime',
                 align: 'center',
                 valign: 'middle',
                 sortable: true
              //   formatter: stateFormatter
                // clickToSelect: false,
                // formatter: operateFormatter,
                // events: operateEvents
             } ],  
             onLoadSuccess: function (data) {
                // $result.text('Event: onLoadSuccess, data: ' + data);
             },
             onLoadError: function (status) {
                // $result.text('Event: onLoadError, data: ' + status);
             } 
             
     });
    })
    
      function stateFormatter(value, row, index) {
        if (value) {
        	return ' <i class="fa fa-check text-navy"></i> ';
        }else{
        	return '<i class="fa fa-close text-danger"></i> ';
        }
        return value;
    }
    
    function responseHandler(res) {
    	tt = res.totalCount;
		return {
			"rows" : res.list,//后台DwzModel 的属性
			"total" : res.totalCount//后台DwzModel 的属性
		};
}

// 传递的参数
//search: undefined, sort: "name", order: "desc", limit: 25, offset: 0
function queryParams(params) {
	var page = 0;
	if(tt == 0 ){
	}else{
		page = params.offset % params.limit == 0 ? params.offset / params.limit : params.offset % params.limit +1;
	}
	return {
		numPerPage : params.limit,
		pageNum : page+1,
		orderDirection : params.order,
		orderField : params.sort
		
	};
	
}
 

//新增
sy.admin.menu${(OP.TMenu.id)!}.add = function(){
	sy.showWindow({
			title:'增加管理员',
			href:'op_add_${(OP.TMenu.id)!}.action',
			width:'800px',
			height:'600px',
			okhandler:function(){
				sy.admin.menu${(OP.TMenu.id)!}.save();
			},
			cancelhandler:function(){
				sy.closeWindow();
			}
		});
}

	//编辑
sy.admin.menu${(OP.TMenu.id)!}.edit = function(){
	var rows =$('#admin_menu${(OP.TMenu.id)!}_datagrid').bootstrapTable('getSelections');
	if(rows.length==0){
		 sy.toastrsAlert({
		     code:'info',
		     msg:'请选择你要编辑的记录'
		});
		return;
	}
	if(rows.length > 1){
		 sy.toastrsAlert({
		     code:'warning',
		     msg:'sorry , 只能选择一条进行编辑'
		});
		return;
	}
	sy.showWindow({
			title:'编辑管理员',
			href:'op_edit_${(OP.TMenu.id)!}.action?id='+rows[0].id,
			width:'800px',
			height:'600px',
			okhandler:function(){
				sy.admin.menu${(OP.TMenu.id)!}.save();
			},
			cancelhandler:function(){
				sy.closeWindow();
			}
		});
}
 
	
	//删除
	sy.admin.menu${(OP.TMenu.id)!}.remove = function(){
		var rows =$('#admin_menu${(OP.TMenu.id)!}_datagrid').bootstrapTable('getSelections');
	if(rows.length==0){
		 sy.toastrsAlert({
		     code:'info',
		     msg:'请选择你要删除的记录'
		});
		return;
	}
	
	sy.confirm(function(){
		var rows =$('#admin_menu${(OP.TMenu.id)!}_datagrid').bootstrapTable('getSelections');
		var ps = [];
    	$.each(rows,function(i,n){
    		ps.push(n.id);
    	});
    	$.ajax({
            type: 'post',
            url: 'op_remove_${(OP.TMenu.id)!}.action',
            data: {"ids":ps.join(",")},
            dataType: 'json',
            success: function (data) {
            	$('#admin_menu${(OP.TMenu.id)!}_datagrid').bootstrapTable('refresh');
            	sy.toastrsAlert({
       		     code:'success',
       		     msg:'删除成功'
       		});
            }
        });
	});
	 
	}
    

    </script>
       <div class="wrapper wrapper-content gray-bg animated  ${(cfg.animated)!}   "   style="height:100%">
                <div class="ibox">
                    <div class="ibox-content">
                                <#include "../toolbar.html"/>
                                <table id="admin_menu${(OP.TMenu.id)!}_datagrid"    data-mobile-responsive="true" >
                                </table>
                    </div>
                </div>
                </div>
 